package order

import (
	"time"
)

type OrderParknflyPaymentStruct struct {
	Id                       int       `gorm:"type:int(11) auto_increment; NOT NULL; primary_key"`
	OrderNo                  string    `gorm:"type:varchar(255); COMMENT:'系统单号'"`
	ParknflyOrderNo          int       `gorm:"type:int(11); COMMENT:'泊安飞单号'"`
	ReservationEndTimeBefore time.Time `gorm:"type:datetime; COMMENT:'原预约时间'"`
	ReservationEndTimeAfter  time.Time `gorm:"type:datetime; COMMENT:'修改后预约时间'"`
	CreatedAt                time.Time `gorm:"type:datetime"`
	UpdatedAt                time.Time `gorm:"type:datetime"`
	Money                    int       `gorm:"type:money"`
}

func (c *OrderParknflyPaymentStruct) TableName() string {
	return "order_parknfly_payment"
}

// // 订单补缴金额
// func (c *OrderParknflyPaymentStruct) PaymentMoeny(orderNo, parknflyOrderNo string) float64 {
// 	var money sql.NullFloat64

// 	db := model.Db

// 	db.Table(c.TableName()).
// 		Select("SUM(money) as money").
// 		Where("order_no", orderNo).
// 		Where("parknfly_order_no", parknflyOrderNo).
// 		Scan(&money)

// 	if money.Valid {
// 		// money 包含有效的 float64 值
// 		actualMoney := money.Float64 / 100
// 		return actualMoney
// 	} else {
// 		// money 是 NULL
// 		return 0.0 // 或者根据需要返回其他默认值
// 	}
// }
